﻿@model IEnumerable<YGLAB_SON.Models.UserProfile>
@{
    ViewBag.Title = "Listele";
    Layout = "~/Views/Kullanici/_KullaniciLayout.cshtml";
}

<h2>Kullanıcıları Listele</h2>



<table>
    <tr>
                <th>Kullanıcı Id</th>
             <th> Kullanıcı Adı</th>
             <th>Email</th>
             <th>Kullanıcı Rolleri</th>
        <th>İşlemler</th>
    </tr>
    @foreach (var item in Model)
    {
        string[] roller = Roles.GetRolesForUser( item.UserName );
        <tr>
            <td>
                @Html.DisplayFor( m => item.UserId )
            </td>
            <td>
                @Html.DisplayFor( m => item.UserName )
            </td>
            <td>
                @Html.DisplayFor( m => item.Email )
            </td>
            <td>
               @foreach( var rol in roller ) { 
                   <span>
                       @rol;
                   </span>
                
               }
            </td>
            <td>
                @if( item.UserName != "Admin") {
                     @Html.ActionLink( "Sil" , "Sil", "Kullanici",new { username = item.UserName }, null)
                    @Html.ActionLink( "Rolleri Düzenle" , "Roller", "Kullanici",new { username = item.UserName }, null)
                }
               
            </td>
        </tr>
    }
</table>

